import com.test.platform.model.Project
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

class ProjectRepository {
    private val apiService = RetrofitClient.apiService
    
    suspend fun getProjects(): List<Project> {
        return withContext(Dispatchers.IO) {
            try {
                apiService.getProjects()
            } catch (e: Exception) {
                // 处理错误
                emptyList()
            }
        }
    }
    
    suspend fun createProject(project: Project): Project? {
        return withContext(Dispatchers.IO) {
            try {
                apiService.createProject(project)
            } catch (e: Exception) {
                // 处理错误
                null
            }
        }
    }
}